/*
 * sequential_file.h
 *
 *  Created on: Mar 31, 2012
 *      Author: lin
 */

#ifndef SEQUENTIAL_FILE_H_
#define SEQUENTIAL_FILE_H_

#include <stdio.h>
#include <stddef.h>

typedef struct sequential_file {
    const char *fname;
    FILE *fp;
} sequential_file_t;

sequential_file_t * seq_file_oepn0(const char *name, FILE *fp);

sequential_file_t *seq_file_open1(const char *name, const char *mode);

void seq_file_close(sequential_file_t *file);

int seq_file_read(const sequential_file_t *file, size_t n, char *buf,
        size_t *readed);

int seq_file_write(const sequential_file_t *file, size_t n, const char *buf);

int seq_file_seek(const sequential_file_t *file, int64_t n);

int seq_file_tell(const sequential_file_t *file, int64_t *n);

#endif /* SEQUENTIAL_FILE_H_ */
